package com.bt.lms.ui.action.teacher.basic.info;

import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

/**
 * 学习简历继续添加按钮事件
 */
public class StudyResumeAddBtn implements EventHandler {


    private VBox studyInfoVBox;
    private Integer width = 1280;
    private Integer height = 900;

    public StudyResumeAddBtn(VBox studyInfoVBox) {
        this.studyInfoVBox = studyInfoVBox;
    }


    @Override
    public void handle(Event event) {


       // ObservableList<Node> children = this.studyInfoVBox.getChildren();

        //保存按钮盒子
        HBox saveHBox = new HBox();
        saveHBox.setSpacing(20);
        saveHBox.setAlignment(Pos.CENTER_RIGHT);
        saveHBox.setPadding(new Insets(15,15,15,15));
        double saveHBoxHeight=height*0.01;
        saveHBox.setMaxHeight(saveHBoxHeight);
        saveHBox.setPrefWidth(width);
        Button savaBtn = new Button("保存");
        Button cancelBtn = new Button("取消");
        saveHBox.getChildren().addAll(savaBtn,cancelBtn);
        studyInfoVBox.getChildren().add(saveHBox);

        //children.get(1);


        //学习时间盒子
        HBox timeHBox = new HBox();
        timeHBox.setPadding(new Insets(0,0,0,30));
        timeHBox.setSpacing(20);
        double timeHBoxHeight=height*0.05;
        timeHBox.setPrefHeight(timeHBoxHeight);
        timeHBox.setPrefWidth(width);
        Label timeLb = new Label("学习时间");
        timeLb.setPrefWidth(100);
        DatePicker startTimeDP = new DatePicker();
        Label label = new Label("至");
        DatePicker stopTimeDP = new DatePicker();
        timeHBox.getChildren().addAll(timeLb,startTimeDP,label,stopTimeDP);
        studyInfoVBox.getChildren().add(timeHBox);
        //学习单位盒子
        HBox unitHBox = new HBox();
        unitHBox.setPadding(new Insets(0,0,0,30));
        unitHBox.setSpacing(20);
        double unitHBoxHeight=height*0.05;
        unitHBox.setPrefHeight(unitHBoxHeight);
        unitHBox.setPrefWidth(width);
        Label unitLb = new Label("学习单位");
        unitLb.setPrefWidth(100);
        TextField unitTF = new TextField();
        unitHBox.getChildren().addAll(unitLb,unitTF);
        studyInfoVBox.getChildren().add(unitHBox);
        //学习证明人盒子
        HBox referencesHBox = new HBox();
        referencesHBox.setPadding(new Insets(0,0,0,30));
        referencesHBox.setSpacing(20);
        double referencesHBoxHeight=height*0.05;
        referencesHBox.setPrefHeight(referencesHBoxHeight);
        referencesHBox.setPrefWidth(width);
        Label referencesLb = new Label("学习证明人");
        referencesLb.setPrefWidth(100);
        TextField referencesTF = new TextField();
        referencesHBox.getChildren().addAll(referencesLb,referencesTF);
        studyInfoVBox.getChildren().add(referencesHBox);
        //所学专业名称盒子
        HBox specialtyHBox = new HBox();
        specialtyHBox.setPadding(new Insets(0,0,0,30));
        specialtyHBox.setSpacing(20);
        double specialtyHBoxHeight=height*0.05;
        specialtyHBox.setPrefHeight(specialtyHBoxHeight);
        specialtyHBox.setPrefWidth(width);
        Label specialtyLb = new Label("所学专业名称");
        specialtyLb.setPrefWidth(100);
        TextField specialtyTF = new TextField();
        specialtyHBox.getChildren().addAll(specialtyLb,specialtyTF);
        studyInfoVBox.getChildren().add(specialtyHBox);
        //获得学位盒子
        HBox degreeHBox = new HBox();
        degreeHBox.setPadding(new Insets(0,0,0,30));
        degreeHBox.setSpacing(20);
        double degreeHBoxHeight=height*0.05;
        degreeHBox.setPrefHeight(degreeHBoxHeight);
        degreeHBox.setPrefWidth(width);
        Label degreeLb = new Label("获得学位");
        degreeLb.setPrefWidth(100);
        ComboBox<String> degreeCom = new ComboBox<>();
        degreeCom.getSelectionModel().select("请选择");
        degreeCom.getItems().add("学士");
        degreeCom.getItems().add("博士");
        degreeCom.getItems().add("硕士");
        degreeHBox.getChildren().addAll(degreeLb,degreeCom);
        studyInfoVBox.getChildren().add(degreeHBox);
        //所学内容盒子
        HBox contentHBox = new HBox();
        contentHBox.setPadding(new Insets(0,0,0,30));
        contentHBox.setSpacing(20);
        double contentHBoxHeight=height*0.05;
        contentHBox.setPrefHeight(contentHBoxHeight);
        contentHBox.setPrefWidth(width);
        Label contentLb = new Label("所学内容");
        contentLb.setPrefWidth(100);
        TextArea contentTa = new TextArea();
        contentHBox.getChildren().addAll(contentLb,contentTa);
        studyInfoVBox.getChildren().add(contentHBox);
        //学习简历备注盒子
        HBox notesHBox = new HBox();
        notesHBox.setPadding(new Insets(0,0,0,30));
        notesHBox.setSpacing(20);
        double notesHBoxHeight=height*0.05;
        notesHBox.setPrefHeight(notesHBoxHeight);
        notesHBox.setPrefWidth(width);
        Label notesLb = new Label("学习简历备注");
        notesLb.setPrefWidth(100);
        TextArea notesTa = new TextArea();
        notesHBox.getChildren().addAll(notesLb,notesTa);
        studyInfoVBox.getChildren().add(notesHBox);


    }
}
